﻿using CubicFWNet.Data.Models;
using CubicFWNet.Data.SystemManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CubicFWNet.Application.SystemManager
{
    public class OperatorLogApp
    {
        private readonly OperatorLogRepository _repository = new OperatorLogRepository();

        public IEnumerable<OperatorLog> GetItems()
        {
            return _repository.IQueryable().OrderByDescending(a => a.Time);
        }
        public OperatorLog GetOperatorLog(Guid id)
        {
            return _repository.FindEntity(id);
        }

        public int Delete(Guid id)
        {
            var del = _repository.FindEntity(id);
            if (del == null) return -404;
            return _repository.Delete(u => u.Id == id);
        }
        public int Add(OperatorLog log)
        {
            return _repository.Insert(log);
        }

    }
}
